# coding=utf-8
#

from django.db import models


class Epoch(models.Model):
    """ """
    name = models.CharField(max_length=32, verbose_name="纪元")
    tps = models.FloatField(default=0, verbose_name="探针机算力")

    create_time = models.DateTimeField(auto_now=False, auto_now_add=True, verbose_name="创建时间")
    update_time = models.DateTimeField(auto_now=True, verbose_name="修改时间")

    class Meta:
        ordering = ("-create_time",)
        verbose_name = "纪元"
        verbose_name_plural = "纪元管理"

    def __str__(self):
        return "第%s纪元" % self.name


class PredictProfitHistory(models.Model):
    """ 预计盈利的历史记录 """
    epoch = models.IntegerField(default=0, verbose_name="纪元")
    epoch_progress = models.FloatField(default=0, verbose_name="当前纪元进度")
    daily_predict_profit = models.FloatField(default=0, verbose_name="每日预期收益")
    monthly_predict_profit = models.FloatField(default=0, verbose_name="每月预期收益")

    price = models.FloatField(default=0, verbose_name="qubic价格")

    current_tps = models.FloatField(default=0, verbose_name="当前算力")
    total_tps = models.FloatField(verbose_name="全网总算力")

    total_scores = models.FloatField(default=0, verbose_name="全网总块数")
    predict_daily_score = models.FloatField(default=0, verbose_name="每日预期的区块数")

    predict_qus_per_block = models.FloatField(verbose_name="预估每个块币量")
    predict_avg_amount = models.FloatField(default=0, verbose_name="预估最终平均分")

    usd_cny = models.FloatField(default=0, verbose_name="当前汇率")

    create_time = models.DateTimeField(auto_now=False, auto_now_add=True, verbose_name="创建时间")
    update_time = models.DateTimeField(auto_now=True, verbose_name="修改时间")

    class Meta:
        ordering = ("-create_time",)
        verbose_name = "收益预期历史"
        verbose_name_plural = "收益预期历史管理"

    def __str__(self):
        return "第%s纪元收益记录" % self.epoch

